package dfsketches.bicycles;

public class Packed3dArray implements Structure3d {

	private PackedArray[][] store;
	private int d;
	
	public Packed3dArray(int w, int h, int d, int init_cap) {
		store = new PackedArray[w][h];
		for (int i = 0; i < w; i++)
			for (int j = 0; j < h; j++)
				store[i][j] = new PackedArray(init_cap);
		this.d = d;
	}
	
	@Override
	public int get(int x, int y, int z) {
		return store[x][y].get(z);
	}
	
	public void put(int x, int y, int z, int val) {
		store[x][y].put(z, val);
	}

	public void put(int x, int y, int z_s, int z_f, int val) {
		store[x][y].put(z_s, val);
	}
	
	public void put(int x1, int y1, int z1, int x2, int y2, int z2, int val) {
		for (int x = x1; x <= x2; x++)
			for (int y = y1; y <= y2; y++)
				store[x][y].put(z1, val);
	}

	@Override
	public int getWidth() {
		return store.length;
	}

	@Override
	public int getHeight() {
		return d;
	}

}